# # -*- coding: utf-8 -*-
# def log_cost_time(func):
#     def wrapped(*args, **kwargs):
#         import time
#         begin = time.time()
#         try:
#             return func(*args, **kwargs)
#         finally:
#             print ('func %s cost %s' % (func.__name__, time.time() - begin))
#
#     return wrapped
#
#
# @log_cost_time
# def complex_func(num):
#     ret = 0
#     for i in xrange(num):
#         ret += i * i
#     return ret
#
#
# # complex_func = log_cost_time(complex_func)
#
# if __name__ == '__main__':
#     print complex_func(100000)

def hello(fn):
    def wrapper():
        print("hello, %s" % fn.__name__)
        fn()
        print("goodby, %s" % fn.__name__)

    return wrapper


@hello
def foo():
    print('i am foo')


foo()
